/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SLE_SEEK_HAL_H
#define SLE_SEEK_HAL_H

#ifndef SLE_LOG_TAG
#define SLE_LOG_TAG "[SleHal]"
#endif

#include "sle_loader_hal.h"
#include "sle_seek_hdi.h"
#include "sle_seek_config.h"
#include "sle_hal_errcode.h"
#include <stdint.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  @brief  enable sle seek result callback
 * 
 *  @param  [in] errCode - enable result
 *  @return None
 */
typedef void (*SleHalStartSeekCallback)(SleHalErrorCode errCode);

/**
 *  @brief  disable sle seek result callback
 * 
 *  @param  [in] errCode - disable result
 *  @return None
 */
typedef void (*SleHalStopSeekCallback)(SleHalErrorCode errCode);

/**
 *  @brief  sle seek result callback
 * 
 *  @param  [in] seekResult - seek result
 *  @return None
 */
typedef void (*SleHalSeekResultCallback)(const SleSeekResult *seekResult);

typedef struct {
    SleHalStartSeekCallback OnSeekHalEnableSeekCb;
    SleHalStopSeekCallback OnSeekHalDisableSeekCb;
    SleHalSeekResultCallback OnSeekHalSeekResultCb;
} SleSeekHalCallbacks;

/**
 *  @brief  initialize seek hal
 * 
 *  @param  None
 *  @return None
 */
SleHalErrorCode InitSleSeekHal(void);

/**
 *  @brief  deinitialize seek hal
 * 
 *  @param  None
 *  @return None
 */
SleHalErrorCode DeinitSleSeekHal(void);

/**
 *  @brief  set seek param
 * 
 *  @param  [in] param - seek param
 *  @return None
 */
SleHalErrorCode SleSeekHalSetSeekParam(const SleSeekParam *param);

/**
 *  @brief  start seek
 * 
 *  @param  None
 *  @return None
 */
SleHalErrorCode SleSeekHalStartSeek(void);

/**
 *  @brief  stop seek
 * 
 *  @param  None
 *  @return None
 */
SleHalErrorCode SleSeekHalStopSeek(void);

/**
 *  @brief  register callback
 * 
 *  @param  [in] seekHalcallback - callback
 *  @return None
 * 
 *  @note   seekHalcallback should not be NULL and be released by user when not needed
 */
SleHalErrorCode SleSeekHalRegisterCallback(const SleSeekHalCallbacks *seekHalcallback);

#ifdef __cplusplus
}
#endif

#endif // SLE_SEEK_HAL_H